package com.cqjtu.tto.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author：monkey-L
 * @description: .
 * @date: 14:22 2021/12/6
 */
@Data
@AllArgsConstructor
@ApiModel(description = "统一返回结果类",value = "结果类")
public class Results {

    @ApiModelProperty(value = "请求成功与否")
    private boolean success;

    @ApiModelProperty(value = "状态码")
    private int code;

    @ApiModelProperty(value = "返回信息描述")
    private String msg;

    @ApiModelProperty(value = "返回信息")
    private Object data;

    public static Results success(Object data){
        return new Results(true, 200, "success", data);
    }
    public static Results fail(int code, String msg){
        return new Results(false, code, msg, null);
    }
}
